package org.rainbowinverted.charging.device.connect.bl.server.handler;

import com.dix.codec.bkv.BKV;
import com.yundian.device.api.operation.dto.op.DeviceOpDataDTO;
import io.netty.channel.ChannelHandlerContext;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * 查询设备状态处理程序
 *
 * @author huaiping
 */
@Component
@AllArgsConstructor
public class BlQueryDeviceStatusHandler extends BlAbstractHandler<Void, DeviceOpDataDTO>{

    /**
     * 设备状态查询数据与设备状态上报一样，故使用同一个处理器
     */
    private BlDeviceStatusReportHandler blDeviceStatusReportHandler;

    @Override
    public void write(DeviceOpDataDTO message, BKV bkv) {
        createFuture(getSerialNo(bkv));
    }

    @Override
    public void read(ChannelHandlerContext channelHandlerContext, BKV bkv) {
        blDeviceStatusReportHandler.read(channelHandlerContext, bkv);
    }
}
